<template>
	<view class="padding-top">
		<cu-custom bgColor="bg-top" isBack>
			<block slot="content">我的</block>
		</cu-custom>
		<form class="" @submit="formSubmit">
			<view class="card-menu cu-list menu">
				<view class="cu-item ">
					<view class="content">
						<text class="text-orange cuIcon-roundrightfill"></text>您管理的站点
					</view>
				</view>
			</view>
			<view class="card-menu cu-list menu" >
				<view class="cu-item arrow" v-for="(item,key) in list" :key="key">
					<view class="content padding-tb-sm" @click="bindClick(item.name,item.site_id)">
						{{item.name}}
						<view class="text-gray ">
							 {{item.site_type}}
						</view>
					</view>
				</view>
			</view>
			
		</form>
	</view>
</template>

<script>
	import Util from '@/utils/util.js';
	export default {
		data() {
			return {
				list:[
					{name:'华星光电',site_id:'132',site_type:'水系统'}
				],
			}
		},
		onLoad() {
			let userInfo = Util.getUserInfo();
			//加载站点
			Util.request('/monitor/groupSite/sites/user', {userId:userInfo.userId}, 'GET').then((res) => {
				this.list = []
				res.data.map(item => {
					this.list.push({name:item.siteName,site_id:item.siteId,site_type:'水系统'})
				})
			})
		},
		onUnload() {
			uni.$emit('site_select',{type:-1})
		},
		methods: {
			bindClick(n,i){
				uni.$emit('site_select',{site_name:n,site_id:i,type:1})
				uni.navigateBack({
					delta:1
				})
			}
		}
	}
</script>

<style>

</style>
